home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3538 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  3.4 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.edu,comp.lang.c,comp.lang.c++
  4. Subject: Re: C or C++ for a 14-year old? The definitive reply
  5. Date: 24 Jan 1996 12:16:12 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4e5t1c$71c@solutions.solon.com>
  8. References: <4cve3a$f0n@news.iconn.net> <qq91jhhtbr.fsf@tartarus.ucsd.edu> <4danli$llb@news.onramp.net> <4e3mvdINNpi3@mayne.ugrad.cs.ubc.ca>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <4e3mvdINNpi3@mayne.ugrad.cs.ubc.ca>,
  12. Kazimir Kylheku <c2a192@ugrad.cs.ubc.ca> wrote:
  13. >I know about those things, and can practice most of them under C.
  14. >It's not entirely clear that any real benefits are derived from frills like
  15. >language support for polymorphism and inheritance.
  16.  
  17. This, I would at least partially agree with.  I've been using perl for my
  18. OO recently, and I'm happy with it.
  19.  
  20. >Information hiding leads to inefficiencies---and you _can_ have it in C, by the
  21. >way. Even the C preprocessor lets you have efficient information hiding, if you
  22. >use it with discipline. It's cheaper to access elements of a function via
  23. >macros than be forced to communicate via abstract function calls. The only
  24. >advantage that information hiding gives you is that 1) you can change the
  25. >implementation of the data structure easily without recompiling modules that
  26. >use it (big deal). 2) you have more control over how your software gets used. I
  27. >think it's point 2 that is the chief motivation, because it allows capitalists
  28. >to have better control over the production and trade of software.
  29.  
  30. Huh?
  31.  
  32. Point 1 is, in fact, a *very* big deal.  The larger the project, the more
  33. important it is that a complete rewrite of the internals of one part not
  34. break anything.
  35.  
  36. I'm not quite sure what you mean by point 2.
  37.  
  38. The abstract function calls have the additional advantage that, for almost
  39. any non-trivial task, they make solid the distinction between interface
  40. and implementation.  When I was a kid, I just used internals of the
  41. representations I had chosen.  Modifications were hell.  When I first
  42. tried just the primitive enhancement of using a simple function for
  43. every common access, the next rewrite took me an hour for the internals,
  44. and 5 minutes for the interface.  And it *all* worked.
  45.  
  46. Haven't looked back since.
  47.  
  48. >The concepts of object oriented design and programming transcend the choice of
  49. >programming language. Once can practice sound OO design with C, if one is so
  50. >inclined.
  51.  
  52. True enough.  The advantage of, say, C++, is that the squiggly bits are
  53. already done for you.  The disadvantage of C++ in particular is that the
  54. language is utterly huge, and takes a *long* time to learn well.  (It
  55. has been argued that it's ugly.  I don't entirely buy it.  Some of the
  56. code people write in C++ looks pretty bad, some looks pretty good.  I
  57. don't think it's as pretty as C, but I have never seen a more complex language
  58. look as pretty as a simpler language.  Code in it can often be much more
  59. elegant at the source level.)
  60.  
  61. Good OO design is, of course, not the only or ideal goal.  Some problems
  62. are better addressed with other solutions.
  63.  
  64. -s
  65. -- 
  66. Peter Seebach - seebs@solon.com - Copyright 1995 Peter Seebach.
  67. C/Unix proto-wizard -- C/Unix questions? Send mail for help.  No, really!
  68. Using trn?  Weird new newsgroup problem?  I know the fix!  Email me!
  69. The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq - Not A Flying Toy
  70.